package com.jin.webvideo.base.httpclient;

import com.alibaba.fastjson.JSONObject;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;

import java.nio.charset.UnsupportedCharsetException;
import java.util.Map;

public class JsonHttpEntity extends StringEntity {
    public JsonHttpEntity(Object data, String charset) throws UnsupportedCharsetException {
        super(JSONObject.toJSONString(data), ContentType.create("application/json", charset));
    }
    public JsonHttpEntity(Object data){
        this(data, null);
    }
}
